//引入全局自定义插件
import Svgicon from '@/components/SvgIcon/index.vue'
import Pagination from '@/components/Pagination/Pagination.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import Category from '@/components/Category/index.vue'
//自定义插件对象用于遍历
const allGloablComponents = <any>{ Svgicon, Pagination, Category }
//对外暴露自定义插件
export default {
  //必须叫install

  install(app: any) {
    Object.keys(allGloablComponents).forEach((key) => {
      // const val = allGloablComponents
      // console.log(typeof key) string
      // console.log(typeof val[key]) 组件实例
      app.component(key, allGloablComponents[key])
    })
    // 将element-plus的icon图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
